package com.coffee.concurrent;


import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author Songk.
 * @since 15:54 2020/07/4
 */
public class ThreadPool {

    public static ThreadPoolExecutor buildThreadPool(int corePool, int maxPool, int queueSize, long keepAliveTime, String threadName){
        return new ThreadPoolExecutor(corePool, maxPool,
                keepAliveTime, TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(queueSize),
                new CoffeeThreadFactory(threadName) );
    }


}
